import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../assets/styles.dart';
import '../../../components/easy_toast.dart';
import '../../../generate/app_image_path.dart';
import '../../../routes/routes.dart';
import '../../../utils/color.dart';
import '../../../utils/enum.dart';
import '../../../utils/extension.dart';

class AiEntryPage extends StatelessWidget {
  const AiEntryPage({super.key});

  Widget _buildEnty({
    required String asset,
    required String name,
    required String tips,
    required VoidCallback onTap,
  }) {
    return Column(
      children: [
        ClipRRect(
          borderRadius: Styles.borderRadius.all(8.w),
          clipBehavior: Clip.hardEdge,
          child: Image.asset(
            asset,
            height: 209.w,
            width: double.infinity,
            fit: BoxFit.fill,
          ),
        ),
        12.verticalSpaceFromWidth,
        Row(
          children: [
            Text(
              name,
              style: TextStyle(fontSize: 16.w, fontWeight: FontWeight.w500),
            ),
            Text(
              tips,
              style: TextStyle(fontSize: 14.w, color: COLOR.color_B940FF),
            )
          ],
        )
      ],
    ).onOpaqueTap(onTap);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('AI科技')),
      body: SingleChildScrollView(
        child: Column(
          children: [
            _buildEnty(
              asset: AppImagePath.ai_entry_boyfriend,
              name: 'AI男友',
              tips: '（聊天）',
              onTap: () => EasyToast.show('激情开发中，敬请期待...'),
            ),
            _buildEnty(
              asset: AppImagePath.ai_entry_face_image,
              name: 'AI换脸',
              tips: '（图片）',
              onTap: () => Get.toAiHome(AiTabNameEnum.faceImage),
            ),
            _buildEnty(
              asset: AppImagePath.ai_entry_face_video,
              name: 'AI换脸',
              tips: '（视频）',
              onTap: () => Get.toAiHome(AiTabNameEnum.faceVideo),
            ),
            _buildEnty(
              asset: AppImagePath.ai_entry_cloth_off,
              name: 'AI脱衣',
              tips: '（图片）',
              onTap: () => Get.toAiHome(AiTabNameEnum.cloth),
            )
          ].joinHeight(20.w, tail: true),
        ),
      ).baseMarginHorizontal,
    );
  }
}
